<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            border: 1px solid red;

            /* font-size: 0; */

        }

        img {
            /* display: block; */
            vertical-align: middle;
        }
    </style>
</head>

<body>
    <div>
        <img src="psu.jpg" alt="">
    </div>

    <script>
        function fun(n, o) {
            var n; // n = 0;
            // var n = 1, o;
            console.log(o)
            return {
                fun: function (m) {
                    // var m = 1;
                    return fun(m, n)
                }
            }
        }
        var a = fun(0)
        // {
        //     fun: function (m) {
        //         return fun(m, n)
        //     }
        // }
        a.fun(1) // 0
        a.fun(2) // 
        a.fun(3) //undefined,0,0,0

        var b = fun(0).fun(1).fun(2).fun(3).fun(50).fun(22) //undefined,0,1,2,3,50

        var c = fun(0).fun(1)
        c.fun(2)
        c.fun(3) //undefined,0,1,1
    </script>
</body>

</html>